export const mixinHighLight = function(str, keywords) {
  if (typeof str !== 'string') return ''
  const reg = new RegExp(keywords, 'g')
  return str.replace(reg, `<span style="color: red;">${keywords}</span>`)
}

export const fallRise = {
  methods: {
    formatNum(str) {
      if (typeof str === 'string') {
        return str.replace(/%/g, '')
      } else {
        return str
      }
    },
    fallOrRise(str) {
      if (typeof str === 'string') {
        return str.indexOf('-') === -1
      } else {
        return false
      }
    }
  }
}
